using MicroMsg.Common.Utils;
using MicroMsg.Scene;
using System;
using System.Collections.Generic;
namespace MicroMsg.Manager
{
	public class AppInfoMgr
	{
		public const string TAG = "AppInfoMgr";
		public static AppInfo getAppinfo(string appID, MMAppInfoIconType iconType)
		{
			if (string.IsNullOrWhiteSpace(appID))
			{
				Log.smethod_5("AppInfoMgr", "invalid appID");
				return null;
			}
			Dictionary<string, AppInfo> dictionary = GConfigMgr.read<Dictionary<string, AppInfo>>();
			if (dictionary != null && dictionary.ContainsKey(appID))
			{
				return dictionary.get_Item(appID);
			}
			new NetSceneGetAppInfo().doScene(appID, iconType);
			return null;
		}
		public static bool saveAppInfo(AppInfo appinfo)
		{
			if (appinfo == null)
			{
				Log.smethod_5("AppInfoMgr", "invalid appinfo");
				return false;
			}
			Dictionary<string, AppInfo> dictionary = GConfigMgr.read<Dictionary<string, AppInfo>>();
			if (dictionary == null)
			{
				dictionary = new Dictionary<string, AppInfo>();
			}
			if (!dictionary.ContainsKey(appinfo.AppID))
			{
				dictionary.Add(appinfo.AppID, appinfo);
				GConfigMgr.write<Dictionary<string, AppInfo>>(dictionary);
			}
			return true;
		}
	}
}
